<?php
/**
 *
 *
 * @author: mgli<mgli@kaikeba.com>
 * @date: 2021/3/12
 * @version: 1.0
 * @copyright: mgli@kaikeba.com @ 2021
 * @filename: ComWechatRobot.php
 */

namespace App\Admin\Tools;

use Illuminate\Support\Facades\Http;

class ComWechatRobot
{
    protected $url;

    public function __construct()
    {
        $this->url = env('COM_WECHAT_ROBOT_URL');
    }

    public function sentTextMsg(string $content) : bool
    {
        $msg = [
            'msgtype' => 'text',
            'text' => [
                'content' => $content
            ]
        ];

        $response = Http::post($this->url, $msg);
        if ($response->status() == 200){
            return true;
        }
        return false;
    }
}